import SparkPlugLockKey from "./SparkPlugLockKey";
import LevelBaseControl from "../../../LevelCommon/LevelBaseControl";

export default class SparkPlugLock extends Laya.Script3D{
    
  /** 所有的key*/
  public  lockKeys:Array<SparkPlugLockKey> = new Array<SparkPlugLockKey>();
  /** 当前是否正确了*/
  public  isCorrect:boolean = false;

  onStart()
  {
      let length = this.lockKeys.length;
      for (let i = 0; i < length; i++)
      {this
          let lockKey:SparkPlugLockKey = this.lockKeys[i];
          lockKey.SetData(this);
      }
  }
  /** 检测是否正确*/
  public CheckCorrect()
  {
      let length = this.lockKeys.length;
      for (let i = 0; i < length; i++)
      {
          let lockKey:SparkPlugLockKey = this.lockKeys[i];
          if (!lockKey.IsCorrect())
          {
              return;
          }
      }
      this.isCorrect = true;
      /** 正确*/
      console.log("正确！！！！！！！");
      let curLevelControl:LevelBaseControl = window.gameFacade.LevelMng.GetCurLevelControl();
      curLevelControl.DoInteractObjLogic(this.owner.name + "_Spark_Unlock");
  }
}